<div class="page-header">
    <h1>
        Form Konfirmasi Pembayaran
        <small>
            <i class="icon-double-angle-right"></i>
            Konfirmasi Pembayaran Agent
        </small>
    </h1>
</div>

<?php

if ($this->msg != "") {
    ?>
    <div class="alert alert-info">
        <button type="button" class="close" data-dismiss="alert">
            <i class="icon-remove"></i>
        </button>

        <strong>
            <i class="icon-ok"></i>            
        </strong>

        <?php echo $this->msg; ?>
        <br />
    </div>
    <?php
}
if ($this->errmsg) {
    ?>
    <div class="alert alert-danger">
        <button type="button" class="close" data-dismiss="alert">
            <i class="icon-remove"></i>
        </button>

        <strong>
            <i class="icon-remove"></i>

        </strong>

        <?php echo $this->errmsg; ?>
        <br />
    </div>
<?php
}

if ($this->msg == "") {
?>
    

    <div class="row">
        <div class="col-xs-11">
            <form id="frm" class="form-horizontal" role="form" action="" method="post">
                
                <div class="form-group">
                    <label class="col-sm-2 control-label no-padding-right" for="kodeTrans"> Kode Transaksi </label>

                    <div class="col-sm-9">
                            <input type="hidden" id="transId" name="transId" value="<?php if (isset($this->transId)) { echo $this->transId; } ?>"/>
                            <input type="text" id="kodeTrans" name="kodeTrans" class="col-xs-10 col-sm-5" value="<?php if (isset( $this->transCode )) { echo $this->transCode;} ?>" readonly />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label no-padding-right" for="totalTrans"> Total Transkasi </label>
                    <div class="col-sm-9">
                        <input type="text" id="totalTrans" name="totalTrans" class="col-xs-10 col-sm-5" value="<?php if (isset($this->totalTrans)) { echo number_format($this->totalTrans);} ?>" readonly />
                </div>

            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label no-padding-right" for="tglBayar"> Tanggal Pembayaran </label>

                <div class="col-sm-3">
                    <div class="input-group">
                    <input class="form-control date-picker" id="tglBayar" placeholder="Tanggal Pembayaran" name="tglBayar" type="text" data-date-format="dd/mm/yyyy" required />
                    <span class="input-group-addon">
                            <i class="icon-calendar bigger-110"></i>
                    </span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label no-padding-right" for="caraBayar"> Cara Pembayaran </label>

                <div class="col-sm-9">
                    <select class="width-30 chosen-select" id="caraBayar" name="caraBayar" required>
                        <option value="">Pilih Cara Pembayaran</option>
                        <option value="1">Transfer ATM</option>
                        <option value="2">Internet Banking</option>
                        <option value="3">Mobile Banking</option>
                        <option value="4">Setoran/Transfer Tunai</option>
                    </select>
                </div>
            </div>
                <div class="form-group">
                <label class="col-sm-2 control-label no-padding-right" for="rekAsal"> Dari Rekening </label>

                <div class="col-sm-9">
                    <select class="width-30 chosen-select" id="rekAsal" name="rekAsal" required>
                        <option value="">Pilih Rekening Asal</option>
                        <?php

                        while ($this->getAccMember->next()) {
                            $res = $this->getAccMember->current();

                            echo "<option value='".$res["account_id"]."'>[".$res['bank_acc_no']."] ".$res['bank_name']." ".$res['account_name']."</option>";
                        }

                        ?>
                    </select>
                </div>
            </div>
                <div class="form-group">
                <label class="col-sm-2 control-label no-padding-right" for="rekTujuan"> Rekening Tujuan </label>

                <div class="col-sm-9">
                    <select class="width-30 chosen-select" id="rekTujuan" name="rekTujuan" required>
                        <option value="">Pilih Rekening Tujuan</option>
                        <?php

                        while ($this->getAccPT->next()) {
                            $res = $this->getAccPT->current();

                            echo "<option value='".$res["account_id"]."'>[".$res['bank_acc_no']."] ".$res['bank_name']." ".$res['account_name']."</option>";
                        }

                        ?>
                    </select>
                </div>
            </div>
                <div class="form-group">
                <label class="col-sm-2 control-label no-padding-right" for="jmlTransfer"> Jumlah Transfer </label>

                <div class="col-sm-9">
                    <input type="text" id="jmlTransfer" name="jmlTransfer" placeholder="Tanpa titik/koma (cth: 150000)" class="col-xs-10 col-sm-5" value="" onkeypress='return validateNumber(event)' required />
                </div>
            </div>
            <div class="form-group">
                    <label class="col-sm-2 control-label no-padding-right" for="ket"> Keterangan </label>

                    <div class="col-sm-9">
                            <input type="text" id="ket" name="ket" placeholder="Opsional" class="col-xs-10 col-sm-5"  />
                    </div>
                </div>
            <div class="clearfix form-actions">
                <div class="col-md-offset-3 col-md-9">
                    <button class="btn btn-success" type="submit">
                        <i class="icon-ok bigger-110"></i>
                        Submit
                    </button>

                    &nbsp; &nbsp; &nbsp;
                    <button class="btn" type="reset">
                        <i class="icon-undo bigger-110"></i>
                        Reset
                    </button>
                </div>
            </div>
        </form>
    </div>
</div>

<script>


$("select#caraBayar").change(function(){
     var pay = $("#caraBayar").val();
     if (pay == 4){ //Transfer/setoran Tunai

         document.getElementById("rekAsal").disabled = true;
         
     }else{
        document.getElementById("rekAsal").disabled = false;
     }
  });

function validateNumber(evt) {

    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;
    return true;
}

</script>

<?php } ?>